import { LoggerMoudle } from "../src";
import { http_quest } from "../lib/HttpQuest";

class LG extends LoggerMoudle<string>{
    addTest(uid: string, event: string, name: string) {
        this.logEvent(uid, event, { name: name })
    }
}
let lg = new LG()



describe('日志测试', () => {
    before(function (done) {
        lg.init(
            LoggerMoudle.types.logkit, {
            url: "http://127.0.0.1:8199/api/logger",
            projectid: 2
        })
        done()
    })
    it('增加日志', function (done) {
        lg.addTest("123", "login", "chenkai")
        done()
    })

    it('api日志', async function () {
        this.timeout(5000)

        let req = lg.apiBegin("http://www.baidu.com", "get", "123")
        let v = await http_quest("get", "http://www.baidu.com")
        lg.apiEnd(req, true, v)
        return true;
    })


    after(function (done) {
        setTimeout(function () {
            process.exit()
        }, 3000)
        done()
    })
});